/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fait.ferm.global;

import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;

/**
 * Чтобы не создавать для таблицы каждый раз новый класс
 * @author alex
 */
public class TB {
	public static<T extends TB.Table2Col> void bind(TableView<T> tb){
		int n=1;
				for(TableColumn c:  tb.getColumns()){
			c.setCellValueFactory(new PropertyValueFactory<T, String>("c"+String.valueOf(n)));
			++n;
		}

	}
	public static class Table2Col{
		public String c1;
		public String c2;
		public Table2Col(String p1,String p2){
			c1 = p1;
			c2 = p2;
		}
		public String getC1() {
			return c1.toString();
		}

		public String getC2() {
			return c2.toString();
		}
	}
	public static class Table3Col extends Table2Col{
		public String c3;
		public Table3Col(String p1,String p2,String p3){
			super(p1, p2);
			c3 = p3;
		}

		public String getC3() {
			return c3.toString();
		}
	}	
	public static class Table4Col extends Table3Col{
		public String c4;
		public Table4Col(String p1,String p2,String p3,String p4){
			super(p1, p2, p3);
			c4 = p4;
		}

		public String getC4() {
			return c4.toString();
		}
	}	
	public static class Table5Col extends Table4Col{
		public String c5;
		public Table5Col(String p1,String p2,String p3,String p4,String p5){
			super(p1, p2, p3, p4);
			c5 = p5;
		}

		public String getC5() {
			return c5.toString();
		}
	}	
	public static class Table6Col extends Table5Col{
		public String c6;
		public Table6Col(String p1,String p2,String p3,String p4,String p5,String p6){
			super(p1, p2, p3, p4, p5);
			c6 = p6;
		}

		public String getC6() {
			return c6.toString();
		}
	}	
	public static class Table7Col extends Table6Col{
		public String c7;
		public Table7Col(String p1,String p2,String p3,String p4,String p5,String p6,String p7){
			super(p1, p2, p3, p4, p5,p6);
			c7 = p7;
		}

		public String getC7() {
			return c7.toString();
		}
	}	
	public static class Table8Col extends Table7Col{
		public String c8;
		public Table8Col(String p1,String p2,String p3,String p4,String p5,String p6,String p7,String p8){
			super(p1, p2, p3, p4, p5,p6,p7);
			c8 = p8;
		}

		public String getC8() {
			return c8.toString();
		}
	}	
	
	
}
